|
|
Chris Huff wrote:
>
> I was about to post something similar, but I would write it:
>
> #macro Gradient2(Vector)
> #local Len = vlength(Vector);
> #local V = Vector/Len;
> #local FX = V.x;
> #local FY = V.y;
> #local FZ = V.z;
>
> function {
> min(1, max(0, (x*FX + y*FY + z*FZ)/Len))
> // You sure about the /Len here?
> }
> #end
>
> Probably no actual difference in parse time, and render time would be
> the same...it just computes the length and a division fewer
> times(vnormalize() computes the length and divides the vector by that).
>
Sure, i did not spend time optimizing it :-)
Concerning the /Len: Rune wanted to take the length of the vector into
account. Without it would be just like the gradient pattern.
>
> Interesting how one fairly simple looking feature (the function pattern)
> can replace so many others...
>
Yes, although it's probably faster if they are hardcoded.
Christoph
--
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other
things on: http://www.schunter.etc.tu-bs.de/~chris/
Post a reply to this message
|
|